package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.dto.GoodsSalesDTO;
import com.sky.dto.OrdersConfirmDTO;
import com.sky.dto.OrdersPageQueryDTO;
import com.sky.entity.OrderDetail;
import com.sky.entity.Orders;
import com.sky.vo.OrderVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

@Mapper
public interface OrderMapper {

    void addOrder(Orders order);

    Page<OrderVO> getOrdero(OrdersPageQueryDTO ordersPageQueryDTO);

    @Select("select * from orders where  id=#{id}")
    OrderVO getOrderByIdDetail(Long id);

    @Update("update orders set status=#{status} where id=#{id} ")
    void canceOrder(OrdersConfirmDTO ordersConfirmDTO);


    List<OrderDetail> repetition(Long id);

    Integer getStatistics(Integer toBeConfirmed);

    @Select("select * from orders where status=#{status} and  order_time < #{orderTime}")
    List<Orders> getByStatusAndOrdertimeLT(Integer status, LocalDateTime orderTime);

    void update(Orders orders1);

    @Select("select * from orders where  id=#{id}")
    Orders getById(Long id);

    Integer getMap(Map map);

    List<GoodsSalesDTO> top10(LocalDateTime of, LocalDateTime of1);
}
